# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=openra
pkgver=20231010
pkgrel=0
pkgdesc="Open source implementation of the Red Alert engine"
url="https://www.openra.net"
arch="x86_64 armv7 aarch64"
license="GPL-3.0-or-later"
depends="
	dotnet6-runtime
	freetype
	libgdiplus
	lua5.1
	openal-soft-libs
	sdl2
	xdg-utils
	"
makedepends="dotnet6-sdk"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenRA/OpenRA/archive/release-$pkgver.tar.gz"
builddir="$srcdir/OpenRA-release-$pkgver"
options="net"

prepare() {
	default_prepare

	make version VERSION="release-$pkgver"
}

build() {
	make RUNTIME=net6 TARGETPLATFORM=unix-generic
}

check() {
	make RUNTIME=net6 check
}

package() {
	mkdir -p "$pkgdir"/usr/lib/
	cp -a bin/ "$pkgdir"/usr/lib/openra
	# shellcheck disable=1091
	. ./packaging/functions.sh

	install_data . "$pkgdir"/usr/lib/openra/ cnc d2k ra
	make prefix=/usr DESTDIR="$pkgdir" install-linux-shortcuts
	make prefix=/usr DESTDIR="$pkgdir" install-linux-appdata
}

sha512sums="
76968f241f506faf879793b63553bd259eb2ae204c607dcbfdb03078773c32d3d122ffe554049d31fed5cd7d35bf22fb07ef0fa73505a88b2ce7f8ae21189f8d  openra-20231010.tar.gz
"
